<template><!---->
	<div id="test">
    <!--<title-top :fnlist="initObj.Fnlist"></title-top>-->
    <table-body :options="initObj"></table-body>
    <Modal v-model="showTargetInfoModel"
               :title="`${typeName}详情`"
               width="1000"
               :mask-closable = "false"
               footer-hide
               @on-cancel="getRankingStatic(curPage)"
        >
        <Row class="targetHeader">
            <Select filterable v-model="targetInfoQuery.targetName" :placeholder="`请选择${typeName}`" @on-change="searchTeamInfo"
                    style="width:180px; margin-right: 15px;" transfer clearable>
                <Option v-for="item in targetTeamData" :value="item.name" :key="item.id" :title="item.name">{{ item.name }}</Option>
            </Select>
            <Select filterable v-model="targetInfoQuery.status" placeholder="请选择解决状态"  style="width: 150px;margin-right:15px;" @on-change="searchTeamInfo" clearable>
                <Option :value="1">未解决</Option>
                <Option :value="2">已解决</Option>
            </Select>
            <Page :total=teamInfoTotal
                  :page-size="targetInfoQuery.pageSize"
                  show-total show-elevator @on-page-size-change="getTargetInfoSize"
                  @on-change="getTargetInfoPage" style="float: right">
            </Page>
        </Row>
        <TableList :columns="teamInfoCol" :data="teamInfoData"></TableList>
    </Modal>
    <Modal v-model="reportGradeModal.show"
               :title="reportGradeModal.title"
               :mask-closable="false"
               :loading="reportGradeModal.loading"
               @on-ok="reportGrade('gradeValidate')"
               @on-cancel="handleReset('gradeValidate')"
               width="400px">
            <Form ref="gradeValidate" :model="gradeValidate" :rules="ruleChalValidate" :label-width="80">
                <FormItem label="评分" prop="score">
                    <InputNumber type="textarea" v-model="gradeValidate.score" :min="1" :max="curTarget.score" :placeholder="'输入1~'+curTarget.score+'的数字'" style="width:200px"></InputNumber>
                    <!--<p style="color:#ff9900" v-if="hasApplyTag"> <Icon type="ios-information-circle-outline" />该题已经申请过提示，最高得分只能是该题目满分的一半</p>-->
                </FormItem>
            </Form>
        </Modal>
    <Modal v-model="pdfModal"
      	title="pdf预览"
      	width="60"
      	:mask-closable = "false"
      	footer-hide
      	>
      	<!--<iframe src="http://172.18.100.4:18769/ftp/edu-ftp/viewOnline/pdf/F102b386-f32c-4868-902f-00bc1886145b" width="100%" height="600px" ></iframe>-->
        <iframe :src="pdfUrl" width="100%" height="600px" scrolling="none" frameborder="0"></iframe>
	</Modal>
        <package-progress
                :show="showProgress"
                :progress="progress"
                :status="progressStatus"
                @change="change"
                title="打包进度"
        ></package-progress>
  </div>
</template>
<script>
//	import Cookies from 'js-cookie'
import {stTeamRankStatis,downloadSubmitAllReport,downloadSceneAllReport,hasReport} from '@/api/compitionStatic'
import {ctfReport,queryTargetAllot,reportGrade,getTargetTeamList_new} from '@/api/drill_compete'
import {getaccessgroupmember} from '@/api/access_new'
import tableBody from './tableListComponent'
import groupMixin from "@/mixin/groupMixin"
import PackageProgress from '@/components/package-progress/package-progress.vue'
export default {
    name: 'scenes',
    props:['sceneId','poll','drillDetail', 'type','disabledAllBtn'],
    mixins: [groupMixin],
		inject: ['parent'],
	data(){
    const d = function(val){
      this.getRankingStatic(null,null,val)
    }.bind(this);
    const exportFile = function(val){
      this.exportFile();
    }.bind(this);
    const exportScoreRecord = function(val){
      this.exportScoreRecord();
    }.bind(this);
    const downloadAllReport = function(val){
      this.downloadAllReport();
    }.bind(this);
    const validateScore = (rule,value,callback) => {
		let _this = this;
		let score = _this.curTarget.score;
		if((value && (value > score || value < 1)) || value === 0){
			callback(new Error(`请输入1~${score}的数字`));
		}else{
			callback()
		}
	}
    let text;
    let typeFilter = '题目'
    if(this.stMode == 1){ //随意
    	text = '成功攻击的题目个数'
    }else{
    	text = '已成功攻击到的题目'
    }
    if (this.type === 7) {
        text = text.replace('题目', '任务')
        typeFilter = '任务'
    }

	  	return {
            showProgress: false, // 展示进度
            progress: 0, // 进度
            progressStatus: 'active',
	  	  initObj:{
            Button:[
              {
                name:'导出排行',
                fnName:exportFile
              },
              {
              	name:'导出得分记录',
                fnName:exportScoreRecord
              },
              {
              	name:'打包下载所有报告',
                fnName:downloadAllReport,
                  disabled: true
              }
            ],
            Input:[
            ],
            Select:[
                {
                    optionsValue: [],
                    placeholder: `请选择团队`,
                    fnName: this.getRankingStaticById
                }
            ],
            DatePicker:{
              isShow:false,
              fnName:d,
            },
            Page:{
              total:0,
              currentPage:1,
              pageSize:10
            },
            Table:{
              listCol:[
                {
               	  title: '排行',
                  align: 'center',
                  key:'rank',
//                width:60,
                  placement:'top-right',
                  order:2,
                  render:(h,params) => {
		            	let ele;
		            	if(params.row._index < 3 && this.curPage == 1){
		            		ele = h('img',{
		            			attrs:{
		            				src:require(`../../../../assets/scene/top${params.row._index+1}.png`)
		            			},
		            			style:{
		            				display:'inline-block',
//		            				width:'20px',
		            				verticalAlign: 'text-bottom',
    								marginLeft: '20px'
		            			}
		            		})
		            	}else{
		            		ele = h('span',params.row._index+1 + (this.curPage-1)*10)
		            	}
		            	let index = params.row._index+1;
		            	let color;
		            	if(index == 1){
		            		color = '#f34938';
		            	}else if(index == 2){
		            		color = '#eb8205';
		            	}else if(index == 3){
		            		color = '#27b666';
		            	}else{
		            		color = '#000'
		            	}
		            	return h('span',[
		            		h('span',{
		            			style:{
		            				color:color
		            			}
		            		},'排行'),
		            		ele
		            	]);
		            }
                },
                {
                  title:'团队名称',
                  key:'teamName',
                  align:'center',
                  ellipsis:true,
                  tooltip:true,
                  placement:'top-left',
                  order:1,
                    width: 240
                },
//              {
//                title:'势力方名称',
//                key:'partyName',
//                align:'center',
//                ellipsis:true,
//                tooltip:true,
//              },
                {
                  title:'总分',
                  key:'attackScore',
                  align:'center',
                  ellipsis:true,
                  tooltip:true,
                  width:60
                },
                {
                  title:`${typeFilter}总数`,
                  key:'totalCount',
                  align:'center',
                  ellipsis:true,
                  tooltip:true,
                  width:60
                },
                {
                  title:text,
                  key:'finishCount',
                  align:'center',
                  ellipsis:true,
                  tooltip:true,
                  width:60
                },
                {
                  title:'是否完成',
                  key:'isFinish',
                  align:'center',
                  ellipsis:true,
                  tooltip:true,
                  placement:'top-right',
                  render:(h,params) => {
                  	return h('Tag',{
                  		props:{
                  			color:params.row.isFinish == 0 ? 'var(--status-no)': 'var(--status-yes)'
                  		}
                  	},params.row.isFinish == 0 ? '未完成': '已完成')
                  }
                },
                {
                  title:'完成时间',
                  key:'ti',
                  align:'center',
                  ellipsis:true,
                  tooltip:true,
                  width:140,
                  render:(h,params) => {
                  	return h('span',params.row.isFinish ? params.row.ti : '无')
                  }
                },
                {
                	title:'团队成员',
                	key:"groupUsrs",
                	render:(h,params) => {
                		let tagArr = [];
                		tagArr = params.row.teamMembers && params.row.teamMembers.map(user => {
                			return h('Tag',{
                				props:{
                					color:'purple'
                				}
                			},user);
                		})
                		return h('span',tagArr.length > 0 ? tagArr : '无')
                	}
                },
                {
                  title:'是否提交报告',
                  key:'report',
                  align:'center',
                  ellipsis:true,
                  tooltip:true,
                  placement:'top-right',
                  render:(h,params) => {
                  	return h('Tag',{
                  		props:{
                  			color:params.row.fileIds.length ? 'var(--status-yes)': 'var(--status-no)'
                  		}
                  	},params.row.fileIds.length ? '是': '否')
                  }
                },
				{
                	title:'操作',
					key:'action',
                	placement:'top-right',
					width:200,
					opList:[
						{
							txt:'下载',
							disabled:(data) => !data.fileIds.length||this.disabledAllBtn,
							on:{
								click:(data)=>{
									this.downloadTeamAllReport(data)
								}
							}
						},
						{
							txt:'预览',
							disabled:(data) => !data.reportIds.length||this.disabledAllBtn,
							on:{
								click:(data)=>{
									//新的预览接口
									window.open(`/api/minio/filePreview?id=${data.fileIds[0]}`);
									return;
									let reviewUrl = `/api/ftp/edu-ftp/viewOnline/pdf/${params.row.fileId}`;
									this.pdfUrl = `static/pdfjs/web/viewer.html?file=${encodeURIComponent(reviewUrl)}`
									this.pdfModal = true;
								}
							}
						},
						{
							txt:`${typeFilter}信息`,
							disabled:() => {
								return this.disabledAllBtn
							},
							show:(data) => {
								return [2, 4, 7].includes(Number(this.drillDetail.type))
							},
							on:{
								click:(data)=>{
									this.showTargetInfo(data)
								}
							}
						}
					]
				},
                {
                	title:'操作',
					key:'action1',
                	placement:'top-right',
					show:false,
					width:200,
                	// render:(h,params) => {
                	// 	return h('div',[
                	// 		h('Button',{
					// 		  props:{
					// 		    type:'primary',
					// 		    size:'small',
					// 		    disabled:!params.row.fileIds.length||this.disabledAllBtn
					// 		  },
					// 		  style:{
					// 		    marginRight:'5px'
					// 		  },
					// 		  on:{
					// 		    click:()=>{
					// 		    	this.downloadTeamAllReport(params.row)
					// 		    }
					// 		  }
					// 		},'下载'),
					// 		h('Button',{
					// 		  props:{
					// 		    type:'primary',
					// 		    size:'small',
					// 		    disabled:!params.row.reportIds.length||this.disabledAllBtn
					// 		  },
					// 		  style:{
					// 		    marginRight:'5px'
					// 		  },
					// 		  on:{
					// 		    click:()=>{
					// 		    	//新的预览接口
					// 		    	window.open(`/api/minio/filePreview?id=${params.row.fileIds[0]}`);
					// 		    	return;
					// 		    	let reviewUrl = `/api/ftp/edu-ftp/viewOnline/pdf/${params.row.fileId}`;
					// 		    	this.pdfUrl = `static/pdfjs/web/viewer.html?file=${encodeURIComponent(reviewUrl)}`
					// 		    	this.pdfModal = true;
					// 		    }
					// 		  }
					// 		},"预览"),
					// 		h('Button',{
					// 			props:{
					// 				type:'primary',
					// 				size:'small',
					// 				disabled:this.disabledAllBtn
					// 			},
					// 			style:{
					// 				marginRight:'5px',
					// 				width:'60px',
					// 				display: [2, 4, 7].includes(Number(this.drillDetail.type)) ? 'inline-block' : 'none'
					// 			},
					// 			on:{
					// 				click:()=>{
					// 					this.showTargetInfo(params.row)
					// 				}
					// 			}
					// 		},`${typeFilter}信息`)
                	// 	])
                	// }
                },
//              {
//                title:'攻击得分',
//                key:'attackScore',
//                align:'center',
//              },
//              {
//                title:'异常得分',
//                key:'exceptScore',
//                align:'center',
//                ellipsis:true,
//                tooltip:true,
//                render:(h,params)=>{
//                  return h('span', params.row.exceptScore||0)
//                }
//              },
//              {
//                title:'防守得分',
//                key:'defendScore',
//                align:'center',
//                render:(h,params)=>{
//                  return h('span', params.row.defendScore||0)
//                }
//              },
              ],
              listData:[]
            },
            Fnlist:'getRankingStatic',
        },
//      sencenId:'',
        selName:'',
        timeout:{},
        curPage:1,
        pdfUrl:'',
		pdfModal:false,
		targetTeamData:[],
		targetTeamTotal:0,
		queryTargetTeamInfo:{
			pageIndex:1,
			pageSize:10,
			teamName:''
		},
		gradeValidate:{
			"questionId": "",
			"sceneId": this.$route.query.id,
			"score": 0,
			"teamId": ""
		},
		curTarget:{},
		reportGradeModal:{
			show:false,
			title:'评分',
			loading:true
		},
		showTargetInfoModel:false,
		teamInfoTotal:0,
		teamInfoCol:[
			{
				title:`${typeFilter}名称`,
				key:'targetName',
				align:'center',
				ellipsis:true,
				tooltip:true,
				width:100,
				placement:'top-left'
			},
			{
				title:`${typeFilter}镜像`,
				key:'imageName',
				align:'center',
				ellipsis:true,
				tooltip:true,
				width:100,
			},
			{
				title:'解决状态',
				key:'status',
				align:'center',
				ellipsis:true,
				tooltip:true,
				render:(h,params)=>{
					return h('Tag',{
						props:{
							color:this.handlerStatus(params.row.status).color
						}
					},this.handlerStatus(params.row.status).txt)
				}
			},
			{
				title:'分值',
				key:'score',
				align:'center',
				ellipsis:true,
				tooltip:true,
				width:60
			},
			{
				title:'IP',
				key:'ip',
				align:'center',
				ellipsis:true,
				tooltip:true,
				width:100
			},
			{
				title:'端口',
				key:'port',
				align:'center',
				ellipsis:true,
				tooltip:true,
				width:60
			},
            {
            	title:'得分',
                key:'grade',
                align:'center',
                ellipsis:true,
                tooltip:true,
                width:60,
                render:(h,params)=>{
            		return h('span', params.row.grade ? params.row.grade : 0)
                }
            },
            {
            	title:'操作',
                align:'center',
                width:200,
                placement:'top-right',
                key:'action',
				opList:[
					{
						txt:'评分',
						disabled: (data) => data.isNeedSubmitFlag === '1' || data.isFixedFileFlag === '2' || data.visibility === 0 || data.score === 0 ||(this.parent.wpUpMode === 2 && data.report === false) || this.currentTarget.fileIds.length === 0,
						on:{
							click:(data)=>{
								this.gradeValidate.questionId = data.id;
								this.gradeValidate.teamId = data.teamId;
								this.gradeValidate.score = data.grade || 0;
								this.curTarget = data;
								this.reportGradeModal.show = true;
							}
						}
					}
				],
				// render: (h, params) => {
            	// 	return h('div',[
	            //         h('Button',{
		        //             props:{
			    //                 type:'primary',
			    //                 size:'small',
				// 				disabled: params.row.isNeedSubmitFlag === '1' || params.row.isFixedFileFlag === '2' || params.row.visibility === 0 || params.row.score === 0 ||(this.parent.wpUpMode === 2 && params.row.report === false) || this.currentTarget.fileIds.length === 0
		        //             },
		        //             style:{
			    //                 marginRight:'5px',
			    //                 width:'60px'
		        //             },
		        //             on:{
			    //                 click:()=>{
				//                     this.gradeValidate.questionId = params.row.id;
				//                     this.gradeValidate.teamId = params.row.teamId;
				//                     this.gradeValidate.score = params.row.grade || 0;
				//                     this.curTarget = params.row;
				//                     this.reportGradeModal.show = true;
			    //                 }
		        //             }
	            //         },'评分'),
                //     ])
                // }
            }
		],
		teamInfoData:[],
		currentTargetId:'',
		targetInfoQuery:{
			pageIndex:1,
			pageSize:10,
			teamId:'',
			sceneId:this.$route.query.id,
			status:0,
			targetName:''
		},
		ruleChalValidate:{
			chaId:[
				{ required: true, message: `请选择${typeFilter}`, trigger: 'change' },
			],
			flag:[
				{ required: true, message: '请输入Flag', trigger: 'change' },
			],
			score:[
				{ required: true, type:'number',message: '请输入分数', trigger: 'change' },
				{ validator: validateScore, trigger: 'change' }
			],
		}
      }
	},
    components:{
//    'title-top':titleTop,
      'table-body':tableBody,
        PackageProgress
    },
    computed: {
        typeName() {
            return this.type === 7 ? '任务' : '题目'
        },
        stMode() {
            let extension = this.drillDetail.extension
            try {
                extension = JSON.parse(extension)
            } catch (e) {
                extension = {}
            }
            return extension.stMode
        }
    },
    watch:{
        teamList(newValue) {
            this.initObj.Select[0].optionsValue = newValue
        }
    },
    created(){
      //this.getRankingStatic();
    },
    beforeDestroy(){
		clearTimeout(this.timeout)
	},
	mounted(){
  		this.getRankingStatic();
  		this.getTargetTeamList()
        this.hasReport()
	},
  methods:{
      // 查询渗透赛是否有解题报告，没有的情况下不允许打包下载
      hasReport() {
          hasReport(this.$route.query.id).then(({code, data, message}) => {
              if (code !== 1) {
                  this.$Message.warning(message)
              } else {
                  this.initObj.Button.forEach(item => {
                      if (item.name === '打包下载所有报告') {
                          this.$set(item, 'disabled', !data)
                      }
                  })
              }
          }).catch(error => {
              this.$Message.error('查询是否存在解题报告异常')
          })
      },
      change(val) {
          this.showProgress = val
      },
      getTargetTeamList(){
          getTargetTeamList_new({
              pageIndex:1,
              pageSize:2147483647,
              sceneId:this.$route.query.id,
              projectId:this.$route.query.prjid
          }).then(data => {
              if(data.code==1){
                  this.targetTeamData = data.data.items || data.data;
              }else{

              }
          })
      },
      getRankingStaticById(id) {
          this.selName = this.getTeamNameById(id)
          this.getRankingStatic()
      },
    getRankingStatic(page,pageSize,querytime){
      let _this = this;
      let pages = page || 1;
	  this.$set(this.initObj.Page, 'currentPage', pages)
      let rows = pageSize||_this.PZ|| 10;
      let id = '';
      let params={
        pageIndex : pages,
        pageSize : rows
      };
      this.curPage = pages;
      if(this.selName){
        params.teamName =  this.selName;
      }
      //if(querytime){
        //params.createtime = querytime[0];
        //params.lastupdatetime = querytime[1];
      //}
      if(_this.$route.query.id){
        stTeamRankStatis(this.$route.query.id,params).then(data=>{
          if(data.code==1){
            let listData = data.data.items;
            let proArr = listData.map(async item => {
				this.$set(item,'fileId','');
        		this.$set(item,'fileName','');
	   	  		this.$set(item,'groupUsers',[]);
//      		if(item.report == 1){
        			await this.ctfReport(item);
//      		}
        		// await this.getaccessgroupmember(item);
        	})
        	Promise.all(proArr).then(data => {
        		_this.initObj.Table.listData = listData;
        	})
            _this.initObj.Page.total = data.data.total;
            if(this.poll){ //如果需要轮询
            	clearTimeout(this.timeout)
            	this.timeout = setTimeout(() => {
          			//this.getRankingStatic(page, pageSize);
            	},3000)
            }
          }
        })
      }
    },
    saveInfo(val){
    },
    exportFile(){
	  	let sceneId = this.$route.query.id;
	  	let sceneName = this.$route.query.name;
	  	let a = document.createElement("a");
	    document.body.appendChild(a);
	    a.href = `/api/compete/teamScoreRecord/export/${sceneId}/${sceneName}`;
	    a.download = ''; //命名下载名称
	    a.click(); //点击触发下载
	    a.remove();
	},
	exportScoreRecord(){
		let sceneId = this.$route.query.id;
	  	let sceneName = this.$route.query.name;
	  	let a = document.createElement("a");
	    document.body.appendChild(a);
	    a.href = `/api/compete/userSubmitRecord/export/${sceneId}/${sceneName}`;
	    a.download = ''; //命名下载名称
	    a.click(); //点击触发下载
	    a.remove();
	},
	ctfReport(item){
		return new Promise(resolve => {
	   	    let sceneId = this.$route.query.id;
	   	    let teamId = item.teamId;
	   	    ctfReport(sceneId,teamId).then(data => {
		   	  	if(data.code == 1 && data.data){
		   	  		this.$set(item,'reportIds',data.data.map(file =>file.id));
		   	  		this.$set(item,'fileIds',data.data.map(file =>file.fileId));
		   	  		this.$set(item,'fileNames',data.data.map(file =>file.fileName));
		   	  		resolve(true);
		   	  	}else{
		   	  		resolve(false);
		   	  	}
	   	    }).catch(error => {
	   	    	resolve(false);
	   	    })
	    })
    },
    //获取团队成员
    getaccessgroupmember(group){
    	return new Promise(resolve => {
    		getaccessgroupmember(group.teamId).then(data => {
	    		if(data.code == 1){
	    			group.groupUsers = data.data;
	    			resolve(true);
	    		}else{
	    			this.$Message.error('获取团队成员失败！');
	    			resolve(false);
	    		}
	    	}).catch(error => {
	    		this.$Message.error('获取团队成员失败！');
	    		resolve(false);
	    	})
    	})
    },
    downloadAllReport(){
    	let sceneId = this.$route.query.id;
        this.showProgress = true
    	downloadSceneAllReport(sceneId,[],this.downFileProgress).then(data => {
            this.total = 0
    		if(data.type == 'application/octet-stream'){
                const downloadElement = document.createElement("a");
                const href = window.URL.createObjectURL(data);
                downloadElement.href = href;
                downloadElement.download = '解题报告.zip';
                document.body.appendChild(downloadElement);
                downloadElement.click();
                document.body.removeChild(downloadElement); // 下载完成移除元素
                window.URL.revokeObjectURL(href); // 释放掉blob对象
    		}else{
    			this.$Message.error('下载报告失败!不存在文件数据！');
    		}
    	}).catch(error => {
            this.progressStatus = 'wrong'
    		this.$Message.error('下载报告失败!');
    	}).finally(() => {
            this.progress = 100
            setTimeout(() => {
                this.showProgress = false
                this.progressStatus = 'active'
                this.progress = 0
            }, 2000)
        })
    },
      downFileProgress(progress){
          let currentProgress = progress.loaded * 1; //B单位
          if (this.total) {
              this.total += currentProgress
          } else {
              this.total = currentProgress
          }
          currentProgress = this.total - currentProgress ? currentProgress : currentProgress / 2;
          let rate = (((this.total-currentProgress)/this.total)*100).toFixed(2)*1;
          if(!this.rate || rate > this.rate){
              this.progress = rate;
          }
      },
	  downloadTeamAllReport(data){
	    	let sceneId = this.$route.query.id;
	    	let teamName = data.teamName;
	    	downloadSubmitAllReport(sceneId,data.teamName,data.reportIds).then(data => {
	    		if(data.type == 'application/octet-stream'){
	                const downloadElement = document.createElement("a");
	                const href = window.URL.createObjectURL(data);
	                downloadElement.href = href;
	                downloadElement.download = `${teamName}_解题报告.zip`;
	                document.body.appendChild(downloadElement);
	                downloadElement.click();
	                document.body.removeChild(downloadElement); // 下载完成移除元素
	                window.URL.revokeObjectURL(href); // 释放掉blob对象
	    		}else{
	    			this.$Message.error('下载报告失败!不存在文件数据！');
	    		}
	    	}).catch(error => {
	    		this.$Message.error('下载报告失败!');
	    	})
	  },
    showTargetInfo(obj){
			this.showTargetInfoModel = true;
			this.currentTargetId = obj.teamId;
			this.currentTarget = obj;
		this.targetInfoQuery={
			pageIndex:1,
			pageSize:10,
			teamId:'',
			sceneId:this.$route.query.id,
			targetName:'',
            status:0
		};
		this.getTargetInfo();
	},
	getTargetInfo(){
		let params = {...this.targetInfoQuery};
		params.teamId = this.currentTargetId;
		if(params.status===0){
			delete params.status;
        }
		if (this.stMode !== 1) {
            params.sortBy = 'sequence'
        }
		queryTargetAllot(params).then(res=>{
			if(res.code === 1){
				this.teamInfoData = res.data.items;
				this.teamInfoTotal = res.data.total;
			}else{
				this.$Message.error(res.message)
			}
		})
	},
	getTargetInfoSize(size){
		this.targetInfoQuery.pageSize = size;
		this.getTargetInfo()
	},
	getTargetInfoPage(page){
		this.targetInfoQuery.pageIndex = page;
		this.getTargetInfo()
	},
	searchTeamInfo(){
		this.targetInfoQuery.pageIndex = 1;
		this.getTargetInfo()
	},
	handlerStatus(status){
		const mapColor = {
			1:'red',
			2:'green'
		};
		const mapTxt = {
			1:'未解决',
			2:'已解决'
		}
		return{
			color:mapColor[status],
			txt:mapTxt[status]
		}
	},
	openTeamInfo(){
		this.showTargetInfoModel = true;
	},
	reportGrade(){
		this.$refs.gradeValidate.validate((valid) => {
			if(valid){
				reportGrade(this.gradeValidate).then(data => {
					if(data.code == 1){
						this.reportGradeModal.show = false;
						this.$Message.info('操作成功');
						this.getTargetInfo();
					}else{
						this.reportGradeModal.loading = false;
						setTimeout(()=>{
							this.reportGradeModal.loading = true;
						},500)
						this.$Message.warning(data.message);
					}
				}).catch(error => {
					this.reportGradeModal.loading = false;
					setTimeout(()=>{
						this.reportGradeModal.loading = true;
					},500)
				})
			}else{
				this.reportGradeModal.loading = false;
				setTimeout(()=>{
					this.reportGradeModal.loading = true;
				},500)
			}
		}).catch(() => {
			this.reportGradeModal.loading = false;
			setTimeout(()=>{
				this.reportGradeModal.loading = true;
			},500)
		})
	},
	handleReset (name) {
			this.$refs[name].resetFields();
		},
    },
}
</script>

<style>
  .drillsTable .ivu-poptip-body {
    text-align: left!important;
  }
  .scenesHeader{
    margin-bottom: 16px;
  }
  .drillTables{
    min-height: 300px;
  }
  .drillsTable.ivu-table-wrapper{
    overflow: inherit;
  }
</style>
<style scoped>
  .Titles{
    background: #eeeeee;
    margin: 16px auto;
    padding: 10px 0;
  }
  .targetHeader{
    padding: 10px;
    margin-bottom: 10px;
  }
</style>
